#pragma once
#include "GameState.h"
#include "Game.h"
#include "CSGD_ObjectFactory.h"
#include "CSGD_ObjectManager.h"
#include "CBase.h"
#include "CTurret.h"

#include <ctime>


#include <string>
#include <sstream>

using namespace std;

class CSGD_DirectInput;
class CSGD_FModManager;
class CSGD_TextureManager;
class CSGD_MessageSystem;
class CSGD_EventSystem;
class CPlayerTank;
class CBaseMessage;

class CGamePlayState : public IGameState, public IListener
{
private:
	CGamePlayState();
	~CGamePlayState();
	CGamePlayState(const CGamePlayState &gamePlayState);
	CGamePlayState &operator=(const CGamePlayState &gamePlayState);

	CSGD_DirectInput* m_pDInput;
	CSGD_FModManager* m_pFMod;
	CSGD_TextureManager* m_pTexMan;
	CSGD_ObjectFactory<string,CBase>* m_pObjFactory;
	CSGD_ObjectManager* m_pObjManager;
	CSGD_MessageSystem*	m_pMS;
	CSGD_EventSystem* m_pES;

	//Wav file ID's
	int m_bgMusicID;
	int m_nSoundID1;

	int m_nTurretImageID;
	int m_nBulletImageID;

	//integer value to hold the players score that increases by 10 every second
	int m_nPlayerScore;
	float m_fTotalTime;
	float m_fFireTimer;

	//Pointers to the ship and turrets
	CPlayerTank *m_pTank;

	RECT screenSize;

	//Game Objects

public:
	static CGamePlayState* GetInstance();

	void Enter(void);
	bool Input(void);
	void Update(void);
	void Render(void);
	void Exit(void);
	
	void HandleEvent(CEvent* pEvent);
	static void MessageProc(CBaseMessage* pMsg);
};